package com.zhaoshixin.es.controller;


import com.zhaoshixin.es.entity.People;
import com.zhaoshixin.es.service.IPeopleService;
import com.zhaoshixin.es.vo.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.aggregation.AggregatedPage;
import org.springframework.web.bind.annotation.*;

import java.util.Random;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhaoshixin
 * @since 2022-07-26
 */
@RestController
@RequestMapping("/people")
@CrossOrigin
public class PeopleController {
    @Autowired
    private IPeopleService peopleService;
    @RequestMapping("/list")
    public Object list(@RequestBody Query query,@RequestParam("pageNum")Integer pageNum,@RequestParam("pageSize")Integer pageSize){
        System.err.println(query);
        AggregatedPage aggregatedPage= peopleService.getList(query,pageNum,pageSize);
        return aggregatedPage;
    }
}

